package com.door.erp.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.door.erp.enums.BaseInfoStatus;

/**
 * 开销
 * @author yangxuelin
 */
@Entity
@Table(name = "expenditure", catalog = "door")
public class Expenditure implements Serializable {

	private static final long serialVersionUID = -4706823165880581444L;

	private long id;
	
	private Employee employee;
	
	private ExpenditureType type;
	
	private String reason;
	
	private double money;
	
	private BaseInfoStatus status;
	
	private String remark;
	
	private Date createTime;

	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@OneToOne()
    @JoinColumn(name="employeeId")
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	@OneToOne
	@JoinColumn(name = "type", nullable = false)
	public ExpenditureType getType() {
		return type;
	}

	public void setType(ExpenditureType type) {
		this.type = type;
	}

	@Column(name = "reason", nullable = false)
	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	@Column(name = "money", nullable = false)
	public double getMoney() {
		return money;
	}

	public void setMoney(double money) {
		this.money = money;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	@Column(name = "status", nullable=false, columnDefinition="int default 0")
	public BaseInfoStatus getStatus() {
		return status;
	}

	public void setStatus(BaseInfoStatus status) {
		this.status = status;
	}
	
	@Column(name="createTime", nullable=false, updatable=false)
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

}
